package com.ly.lypopupwindowdemo.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.ly.lypopupwindowdemo.R;

public class DuanDianActivity extends AppCompatActivity {

    private static final String TAG = "DuanDianActivity";


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_duan_dian);

        /**
         * http下载文件
         */

//        String url = "https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1507520792&di=a05bd16734764d86ce1ffd1d3b20b599&src=http://upload.ellechina.com/2017/0927/1506511179498.jpeg";
//
//
//        okhttp3.Request request = new okhttp3.Request.Builder().url(url).build();
//        OkHttpClient mOkHttpClient = new OkHttpClient();
//        mOkHttpClient.newCall(request).enqueue(new Callback() {
//            @Override
//            public void onFailure(Call call, IOException e) {
//
//            }
//
//            @Override
//            public void onResponse(Call call, Response response) throws IOException {
//
//                InputStream inputStream = response.body().byteStream();
//                FileOutputStream fileOutputStream = null;
//                try {
//                    fileOutputStream = new FileOutputStream(new File("/sdcard/sheep.jpeg"));
//                    byte[] buffer = new byte[2048];
//                    int len = 0;
//                    while ((len = inputStream.read(buffer)) != -1) {
//                        fileOutputStream.write(buffer, 0, len);
//                    }
//                    fileOutputStream.flush();
//                } catch (IOException e) {
//                    Log.i(TAG, "onResponse: IOException");
//                    e.printStackTrace();
//                }
//            }
//        });


    }


}
